home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
amigadoslibrary
/
read.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
1KB
|
48 lines
/* Read.c V1.0 93-03-15 */
/* ROM library: "dos.library/Read", (All versions) */
/* Copyright 1993, Anders Bjerin, Amiga C Club */
#include <dos/dos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
#include <stdlib.h>
UBYTE *version = "$VER: Read 1.0";
int main( int argc, char *argv[] );
int main( int argc, char *argv[] )
{
BPTR my_file;
int my_data[ 5 ];
long bytes_read;
/* Open an old (already existing) file: */
my_file = Open( "RAM:Score.dat", MODE_OLDFILE );
if( !my_file )
exit( 20 );
/* Read some data: */
bytes_read = Read( my_file, my_data, sizeof( my_data ) );
/* Did we get all data? */
if( bytes_read != sizeof( my_data ) )
{
/* Could not collect all data! */
/* Check if it was EOF or an Error: */
if( bytes_read == -1 )
printf( "There was an error!\n" );
else
printf( "Unexpected EOF!\n" );
}
else
printf( "All data were successfully collected!\n" );
/* Close the file: */
Close( my_file );
exit( 0 );
}